//部分控制器
var app = angular.module('myApp.controllers');

//example首页
app.controller('partnerIndex', ["$scope", "utilService", "$rootScope", "$ionicScrollDelegate", function ($scope, utilService, $rootScope, $ionicScrollDelegate) {
    // 模拟数据
    $scope.shopList = [
        {id:'1',isEdit: false},
        {id:'2',isEdit: false},
        {id:'2',isEdit: false},
        {id:'2',isEdit: false},
        {id:'2',isEdit: false},
        {id:'2',isEdit: false},
        {id:'2',isEdit: false},
        {id:'2',isEdit: false},
    ]
    var contScroll;
    utilService.$timeout(function() {
        contScroll = $ionicScrollDelegate.$getByHandle('mainScroll');
    });
    $scope.showSearch = false;
    $scope.dragDown = function () {
        var top = contScroll.getScrollPosition().top;
        if (top >= 500) {
            $scope.showSearch = true;
        } else {
            $scope.showSearch = false;
        }
    }



    $scope.$on('$ionicView.beforeEnter', function () {
        //页面刚加载
        utilService.$ionicLoading.show(HX_CONFIG.loadingBase);
    }, false);
    $scope.$on('$ionicView.afterEnter', function () {
        utilService.$rootScope.rootData.title = '车主服务';
        //页面加载完成
        utilService.$ionicLoading.hide();
    }, false);
    $rootScope.$on('$ionicView.beforeLeave', function (e, ion) {
        //页面离开之前
        //alertPopup && alertPopup.close();

    }, false);

}]);
